<page-grid>
    <sf
        #sf
        mode="search"
        [schema]="searchSchema"
        autocomplete="off"
        [formData]="params"
        (formSubmit)="searchDataGet($event)"
        (formReset)="reSetDataGet(params)"
    />
    <div space-card>
        <button nz-button *aclIf="['admin', 'system:oss:upload']" [nzType]="'primary'" (click)="uploadFile()">
            <i nz-icon nzType="upload" nzTheme="outline"></i>上传文件
        </button>
        <button nz-button *aclIf="['admin', 'ystem:oss:upload']" [nzType]="'primary'" (click)="uploadImg()">
            <i nz-icon nzType="upload" nzTheme="outline"></i>上传图片
        </button>
        <button
            nz-button
            [disabled]="!(multipleCheckedItems.length > 0)"
            *aclIf="['admin', 'system:oss:remove']"
            [nzType]="'primary'"
            nzDanger
            (click)="delFiles(multipleCheckedItems)"
        >
            <i nz-icon nzType="delete" nzTheme="outline"></i>删除
        </button>
        <button
            nz-button
            *aclIf="['admin', 'system:oss:edit']"
            [nzType]="'primary'"
            nzDanger
            (click)="handlePreviewListResource(!previewListResource)"
        >
            <i nz-icon nzType="eye" nzTheme="outline"></i>预览开关: {{ previewListResource ? '禁用' : '启用' }}
        </button>
        <button nz-button *aclIf="['admin', 'system:oss:list']" [nzType]="'primary'" (click)="navToConfig()">
            <i nz-icon nzType="setting" nzTheme="outline"></i>配置管理
        </button>
    </div>
    <st
        #st
        [bordered]="bordered"
        [data]="url"
        [req]="reqReName"
        [res]="resReName"
        [ps]="ps"
        [columns]="columns"
        [scroll]="scroll"
        [size]="tableSize"
        [page]="pageSet"
        [widthMode]="widthMode"
        (change)="simpleTableCheck($event)"
    >
        <ng-template st-row="filePreviewCustom" let-item let-index="index">
            <ng-container *ngIf="previewListResource && showImgFile(item.fileSuffix); else showText">
                <img class="preview-img" nz-image [nzSrc]="item.url" alt="" />
            </ng-container>
            <ng-template #showText>
                <span class="long-text" nz-tooltip [nzTooltipTitle]="item.url">{{ item.url }}</span>
            </ng-template>
        </ng-template>
    </st>
</page-grid>
